import React, { Component } from 'react';

class DOM_three extends Component{
    constructor(){
        super()
        this.state={
            like:"看书",
            count:0
        }
    }
    //函数方程
    changeLike(){
        this.setState({
            like:"喜欢敲代码-codding"
        })
    }
    //箭头函数
    add=(num)=>{
        this.setState({
            count:this.state.count+num
        })
    }
    getId=(e)=>{
        console.log('e',e.target.dataset.id)
    }
    username="张三"

    render(){
        return(
            <>
                <h2 className="title"> 案例（知识点)</h2>
                count++:{this.state.count}
                <button className="butt" onClick={()=>this.add(5)}>点击count++该变值</button>
                <button className="buttd" data-id="100" onMouseLeave={(e)=>this.getId(e)}>点击跳转详情</button>
            </>
        )
    }
}